package com.code.god.mysql.init;

import com.code.god.mysql.util.ConnectionObject;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

public class InitObject {
    public static final Map<String, ConnectionObject> CONNECTIONS = new HashMap<>();

    public static final Connection getConnection(String connectionName) throws Exception{
        ConnectionObject connectionObject = CONNECTIONS.get(connectionName);
        DataSource dataSource = connectionObject.getDataSource();

        Connection connection = null;

        connection = dataSource.getConnection();

        return connection;
    }
}
